all_classes.php

<?php

if (!function_exists('get_objects')){

/**
 * Get classes, traits
 * @todo add of interfaces ... anything else?
 * @return `['classes'=>[...$files],'traits'=>[...$asts]]`
 */
function get_objects(\Tlf\Scrawl $scrawl) {
    $objects = [];
    $apis = $scrawl->getOutputs('api');
    // print_r(array_keys($apis));
    // exit;
    foreach ($apis as $key => $file){
        if ($file['type']!='file')continue;
        // ob_start();

        // unset($file['class']);

        // var_dump($scrawl->file);
        // exit;
        $path = substr($file['path'], strlen($scrawl->dir));
        if ($path[0]!='/')$path = '/'.$path;
        foreach ($file['class']??$file['namespace']['class']??[] as $index=>$classAst){
            $classAst['file'] = $path;
            $objects['classes'][$classAst['fqn']??$classAst['name']] = $classAst;
        }
        foreach ($file['trait']??[] as $index=>$traitAst){
            $traitAst['file'] = $path;
            $objects['traits'][$traitAst['fqn']??$traitAst['name']] = $traitAst;
        }
    }

    return $objects;
}
}

$objects = get_objects($this);
?>
# All Classes
Documentation generated by @easy_link(tlf, php/code-scrawl)

<?php
// print_r(array_keys($objects));
foreach ($objects['classes'] as $class):

    // print_r($class);
    $name_path = str_replace('\\','/', $class['fqn']);
?>
## <?=$class['fqn']??$class['name']?>  
<?=$class['docblock']['description'] ?? 'no docblock'?>  
See [<?=$class['name']?>.php](/docs/api<?=$class['file']?>) for more.


<?php
endforeach;